@extends('user.layouts.layout')
@section('title', '提现信息')

@section('content')
    <div class="mx-auto md:w-1/3 w-full bg-white rounded-lg p-6">
        <form action="{{ route('user.cashinfos.update') }}" method="POST">
            {{ csrf_field() }}
            {{ method_field('PUT') }}
            <div class="block">
                <span class="text-gray-700 text-sm">提现方式</span>
                <div class="mt-2">
                    <select name="cash_type" id="cash_type" class="form-select w-full @error('cash_type')border-red-600 @enderror" required>
                        <option value="">-请选择提现方式-</option>
                        @foreach(\App\Models\CashInfo::$cashTypeMap as $k => $v)
                            <option value="{{ $k }}" @if(old('cash_type') === $k || (!is_null($info) && $info->cash_type === $k))selected @endif>{{ $v }}</option>
                        @endforeach
                    </select>
                </div>
                @error('cash_type')
                <p class="mt-2 text-sm text-red-600">{{ $message }}</p>
                @enderror
            </div>
            <div class="block mt-3">
                <span class="text-gray-700 text-sn">真实姓名</span>
                <input type="text" name="realname" placeholder="请输入真实姓名 输入错误无法到账" required value="{{ old('realname') ?: $info->realname ?? '' }}" class="form-input mt-1 block w-full rounded-md focus:border-indigo-600 @error('realname')border-red-600 @enderror">
                @error('realname')
                <p class="mt-2 text-sm text-red-600">{{ $message }}</p>
                @enderror
            </div>
            <div class="block mt-3">
                <span class="text-gray-700 text-sn">提现账号</span>
                <input type="text" name="account" placeholder="微信请输入微信号，提现请联系客服。" required value="{{ old('account') ?: $info->account ?? '' }}" class="form-input mt-1 block w-full rounded-md focus:border-indigo-600 @error('account')border-red-600 @enderror">
                @error('account')
                <p class="mt-2 text-sm text-red-600">{{ $message }}</p>
                @enderror
            </div>
            <div class="mt-6">
                <button class="py-3 px-4 text-center bg-indigo-600 rounded-md w-full text-white text-sm hover:bg-indigo-500">
                    提交
                </button>
            </div>
        </form>
    </div>
@endsection
